|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--com.caucho.vfs.StreamImpl
|
+--com.caucho.vfs.SocketStream
Specialized stream to handle sockets.
Unlike VfsStream, when the read() throws and IOException or a SocketException, SocketStream will throw a ClientDisconnectException.
| Fields inherited from class com.caucho.vfs.StreamImpl |
nullPath, path |
| Constructor Summary | |
SocketStream(java.net.Socket s)
|
|
| Method Summary | |
boolean |
canRead()
Returns true since the socket stream can be read. |
boolean |
canWrite()
Returns true if this is a writable stream. |
void |
close()
Closes the underlying sockets and socket streams. |
void |
flush()
Flushes the socket. |
int |
getAvailable()
Returns the number of bytes available to be read from the input stream. |
byte[] |
getNewline()
Returns the stream's natural newline character. |
void |
init(java.net.Socket s)
Initialize the SocketStream with a new Socket. |
int |
read(byte[] buf,
int offset,
int length)
Reads bytes from the socket. |
void |
setNewline(byte[] newline)
|
void |
write(byte[] buf,
int offset,
int length,
boolean isEnd)
Writes bytes to the socket. |
| Methods inherited from class com.caucho.vfs.StreamImpl |
clearWrite, getAttribute, getAttributeNames, getFlushOnNewline, getPath, getReadPosition, hasSkip, removeAttribute, setAttribute, setPath, skip |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public SocketStream(java.net.Socket s)
| Method Detail |
public void init(java.net.Socket s)
s - the new socket.public void setNewline(byte[] newline)
public byte[] getNewline()
StreamImplgetNewline in class StreamImplpublic boolean canRead()
canRead in class StreamImpl
public int read(byte[] buf,
int offset,
int length)
throws java.io.IOException
read in class StreamImplbuf - byte buffer receiving the bytesoffset - offset into the bufferlength - number of bytes to readthrows - ClientDisconnectException if the connection is dropped
public int getAvailable()
throws java.io.IOException
getAvailable in class StreamImplpublic boolean canWrite()
StreamImplcanWrite in class StreamImpl
public void write(byte[] buf,
int offset,
int length,
boolean isEnd)
throws java.io.IOException
write in class StreamImplbuf - byte buffer containing the bytesoffset - offset into the bufferlength - number of bytes to readisEnd - if the write is at a close.throws - ClientDisconnectException if the connection is dropped
public void flush()
throws java.io.IOException
flush in class StreamImpl
public void close()
throws java.io.IOException
close in class StreamImpl
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||